package com.bestom.bluetoothlock.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPrefrencesHelper {
    private Context context;
    private SharedPreferences sharedPreferences;

    public SharedPrefrencesHelper(Context context2) {
        this.context = context2;
        this.sharedPreferences = context2.getSharedPreferences(Constants.SHARED_NAME, 0);
    }

    public boolean saveString(String str, String str2) {
        SharedPreferences.Editor edit = this.sharedPreferences.edit();
        edit.putString(str, str2);
        return edit.commit();
    }

    public boolean saveInt(String str, int i) {
        SharedPreferences.Editor edit = this.sharedPreferences.edit();
        edit.putInt(str, i);
        return edit.commit();
    }

    public boolean saveLong(String str, long j) {
        SharedPreferences.Editor edit = this.sharedPreferences.edit();
        edit.putLong(str, j);
        return edit.commit();
    }

    public boolean saveBoolean(String str, boolean z) {
        SharedPreferences.Editor edit = this.sharedPreferences.edit();
        edit.putBoolean(str, z);
        return edit.commit();
    }

    public String getString(String str) {
        return this.sharedPreferences.getString(str, "");
    }

    public String getString(String str, String str2) {
        return this.sharedPreferences.getString(str, str2);
    }

    public int getInt(String str) {
        return this.sharedPreferences.getInt(str, 0);
    }

    public long getLong(String str) {
        return this.sharedPreferences.getLong(str, 0);
    }

    public boolean getBoolean(String str) {
        return this.sharedPreferences.getBoolean(str, false);
    }
}
